package com.itheima.web.controller;

import com.itheima.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-13 09:21
 * @description
 */


@Controller
@RequestMapping("/users")
public class demo1_UserController {

    @RequestMapping("/login")
    @ResponseBody
    public String login(
            @RequestParam("username") String username,
            @RequestParam("password")String password){

        System.out.println("获取参数:"+username+"--"+password);

        return "success";
    }

    @RequestMapping("/findById")
    @ResponseBody
    public User findById(
            @RequestParam("id") Integer id){

        User user = new User(1, "小红", "123", "123@qq.com");

        return user;
    }





}
